
TARGET = tst

CC = gcc
CXX = g++

INCLUDES = 
LIBS = 
CPPFLAGS = 
CFLAGS = -Wall -Werror -pipe -g
LINKFLAGS =

C_SOURCES = $(wildcard *.c)
C_OBJS = $(patsubst %.c, %.o, $(C_SOURCES))
CPP_SOURCES = $(wildcard *.cpp)
CPP_OBJS = $(patsubst %.cpp, %.o, $(CPP_SOURCES))

#C_OBJS = main.o

.c.o:
	$(CC) -c -o $*.o $(CPPFLAGS)  $(CFLAGS) $(INCLUDES) $*.c
.cpp.o:
	$(CXX) -c -o $*.o $(CPPFLAGS)  $(CFLAGS) $(INCLUDES) $*.cpp


compile: $(CPP_OBJS) $(C_OBJS)
	$(CXX) $(LINKFLAGS) -o $(TARGET) $^ $(LIBS)

debug:
	make CPPFLAGS="$(CPPFLAGS) " CFLAGS="$(CFLAGS) -g" LINKFLAGS="" compile

best:
	make CPPFLAGS="$(CPPFLAGS) -DNDEBUG"  CFLAGS="$(CFLAGS) -O2 -fomit-frame-pointer -march=pentium4" LINKFLAGS="-s" compile

clean:
	rm -f $(CPP_OBJS) $(C_OBJS)
	rm -f $(TARGET)

rebuild: clean compile 
